<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui"
	xmlns:c="http://java.sun.com/jsp/jstl/core">

	<p:dialog id="sanPhamDialogId" header="Chi tiết sản phẩm" widgetVar="sanPhamDialog" showEffect="fade" hideEffect="fade"
		resizable="false" modal="true" appendToBody="true" maximizable="true">
		<h:form id="sanPhamDetailFormId">
			<h:panelGrid id="sanPhamPanelGridId" columns="2" cellpadding="4">
				<f:facet name="header">
					<p:messages autoUpdate="true" />
				</f:facet>

				<h:outputText value="Hình ảnh:" style="font-weight:bold" />
				<p:fileUpload fileUploadListener="#{sanPhamView.handleImageUpload}" update=":sanPhamDetailFormId:sanPhamPanelGridId"
					mode="advanced" sizeLimit="100000" allowTypes="/(\.|\/)(gif|jpe?g|png)$/" auto="true" />
				<h:outputText value="Hình ảnh:" style="font-weight:bold" />
				<p:graphicImage value="#{sanPhamView.hinhAnh}" />

				<h:outputText value="Mã số *" style="font-weight:bold" />
				<p:inputText value="#{sanPhamView.editedEntity.code}" />

				<h:outputText value="Tên *" style="font-weight:bold" />
				<p:inputText value="#{sanPhamView.editedEntity.name}" />

				<h:outputText value="Thông tin:" style="font-weight:bold" />
				<p:inputText value="#{sanPhamView.editedEntity.thongTin}" />

				<h:outputText value="Loại sản phẩm:" style="font-weight:bold" />
				<p:selectOneMenu value="#{sanPhamView.selectedLoaiSanPhamId}">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems var="loaiSP" value="#{sanPhamView.loaiSPs}" itemLabel="#{loaiSP.name}" itemValue="#{loaiSP.id}" />
				</p:selectOneMenu>


				<h:outputText value="Đơn giá:" style="font-weight:bold" />
				<p:inputText value="#{sanPhamView.editedEntity.donGia}" />

				<h:outputText value="Active:" style="font-weight:bold" />
				<h:selectBooleanCheckbox value="#{sanPhamView.editedEntity.active}" />

				<f:facet name="footer">
					<p:commandButton icon="ui-icon-disk" value="Save" action="#{sanPhamView.saveOrUpdate}" process="@form"
						update=":sanPhamListFormId:sanPhamDataTableId, @form"
						oncomplete="if (!args.validationFailed) sanPhamDialog.hide()">
					</p:commandButton>
					<p:commandButton icon="ui-icon-cancel" value="Cancel" immediate="true" onclick="sanPhamDialog.hide()" />
				</f:facet>
			</h:panelGrid>
		</h:form>
	</p:dialog>

</ui:composition>